//
//  YQManagerCell.m
//  NewRetail
//
//  Created by yuqin on 2019/6/25.
//  Copyright © 2019 yuqin. All rights reserved.
//

#import "YQManagerCell.h"

@implementation YQManagerCell

- (void)setupTableViewCellView {
    self.backgroundColor = MainBlueColor;
    self.layer.cornerRadius = 5;
    self.layer.masksToBounds = YES;
    
    [self addSubview:self.backView];
    [self.backView addSubview:self.icon];
    [self.backView addSubview:self.coinsLab];
    [self.backView addSubview:self.totalLab];
    
    [self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(UIEdgeInsetsMake(0, 0, 0, 0));
    }];
    
    [self.icon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(FIT(30));
        make.centerY.mas_equalTo(self.backView.mas_centerY);
        make.size.mas_equalTo(CGSizeMake(FIT(35), FIT(35)));
    }];
    
    [self.coinsLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.icon.mas_right).mas_equalTo(FIT(10));
        make.top.lessThanOrEqualTo(self.icon.mas_top);
        make.size.mas_equalTo(CGSizeMake(FIT(100), FIT(20)));//100是随意写的
    }];
    
    [self.totalLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-kMargin_right);
        make.bottom.mas_equalTo(-FIT(16));
    }];
}

- (UIView *)backView {
    if (!_backView) {
        _backView = [[UIView alloc] init];
        _backView.backgroundColor = MainBlueColor;
        
    }
    return _backView;
}

- (UIImageView *)icon {
    if (!_icon) {
        _icon = [YQViewFactory imageViewWithImage:YQ_IMAGE(@"")];
        _icon.layer.cornerRadius = FIT(35)/2.0;
        _icon.layer.masksToBounds = YES;
        _icon.backgroundColor = MainRedTextColor;
    }
    return _icon;
}

- (UILabel *)coinsLab {
    if (!_coinsLab) {
        _coinsLab = [YQViewFactory labelWithTextColor:WhiteColor textAlignment:NSTextAlignmentLeft fontSize:kCellFont userBold:NO];
        _coinsLab.text = @"WDC";
    }
    return _coinsLab;
}

- (UILabel *)totalLab {
    if (!_totalLab) {
        _totalLab = [YQViewFactory labelWithTextColor:WhiteColor textAlignment:NSTextAlignmentRight fontSize:FIT(22) userBold:YES];
        _totalLab.text = @"0.000000 WDC";
    }
    return _totalLab;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
